package com.wf.ew.store.service.imp;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.wf.ew.common.PageResult;
import com.wf.ew.store.dao.StoreAppMapper;
import com.wf.ew.store.model.StoreApp;
import com.wf.ew.store.service.StoreAppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StoreAppServiceImp implements StoreAppService {

    @Autowired
    private StoreAppMapper storeAppMapper;

    @Override
    public PageResult<StoreApp> list(Integer page, Integer limit) {
        Page<StoreApp> storeAppPage = new Page<>(page, limit);
        EntityWrapper<StoreApp> wrapper = new EntityWrapper<>();
        wrapper.orderBy("store_app_id", true);
        List<StoreApp> storeApps = storeAppMapper.selectPage(storeAppPage, wrapper);
        return new PageResult<>(storeApps, storeAppPage.getTotal());
    }
}
